package cn.tedu;

public class oop {
    public static void main(String[] args) {
        Teathch t =new Teathch();
        t.eat();
        t.stay();
        Student s = new Student();
        s.eat();
        s.stay();
        Parent p= new Parent();
        p.eat();
        p.stay();
        Person a= new Teathch();
        a.eat();
        a.stay();

    }
}
interface Person{
    void eat();
    void stay();
}
//创建教师实现类实现person接口
class Teathch implements Person{

    @Override
    public void eat() {
        System.out.println("老师去教师食堂吃饭");
    }

    @Override
    public void stay() {
        System.out.println("老师在教师公寓住宿");
    }
}
//创建学生实现类实现person接口
class Student implements Person{

    @Override
    public void eat() {
        System.out.println("学生去学校食堂吃饭");
    }

    @Override
    public void stay() {
        System.out.println("学生在学校宿舍住宿");
    }
}
//创建学生家长实现类实现person接口
class Parent implements Person{

    @Override
    public void eat() {
        System.out.println("学生家长去招待所吃饭");
    }

    @Override
    public void stay() {
        System.out.println("学生家长在招待所住宿");
    }
}